import type { AddressParams, AddressResult } from "@/types/address"
import { http } from "@/utils/http"

type AddressId = {
  id: string
}

export const PostMemberAddress = (data: AddressParams) => {
  return http<AddressId>({
    url: '/member/address',
    method: 'POST',
    data,
  })
}
//获取收货地址接口
export const getMemberAddressListAPI = () => {
  return http<AddressResult[]>({
    url: '/member/address',
    method: 'GET',
  })
}
export const getMemberAddressInfoAPI = (id: string) => {
  return http<AddressResult>({
    url: `/member/address/${id}`,
    method: 'GET',
  })
}
export const putMemberAddressAPI = (id: string, data: AddressParams) => {
  return http<AddressId>({
    url: `/member/address/${id}`,
    method: 'PUT',
    data,
  })
}
export const deleteMemberAddressAPI = (id: string) => {
  return http<AddressId>({
    url: `/member/address/${id}`,
    method: 'DELETE',
  })
}
